home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / sun / misc / FileURLMapper.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1.0 KB  |  39 lines

  1. package sun.misc;
  2.  
  3. import java.io.File;
  4. import java.net.URL;
  5. import sun.net.www.ParseUtil;
  6.  
  7. public class FileURLMapper {
  8.    URL url;
  9.    String file;
  10.  
  11.    public FileURLMapper(URL var1) {
  12.       this.url = var1;
  13.    }
  14.  
  15.    public String getPath() {
  16.       if (this.file != null) {
  17.          return this.file;
  18.       } else {
  19.          String var1 = this.url.getHost();
  20.          if (var1 != null && !var1.equals("") && !"localhost".equalsIgnoreCase(var1)) {
  21.             String var4 = this.url.getFile();
  22.             String var3 = var1 + ParseUtil.decode(this.url.getFile());
  23.             this.file = "\\\\" + var3.replace('/', '\\');
  24.             return this.file;
  25.          } else {
  26.             String var2 = this.url.getFile().replace('/', '\\');
  27.             this.file = ParseUtil.decode(var2);
  28.             return this.file;
  29.          }
  30.       }
  31.    }
  32.  
  33.    public boolean exists() {
  34.       String var1 = this.getPath();
  35.       File var2 = new File(var1);
  36.       return var2.exists();
  37.    }
  38. }
  39.